/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * interface.c
 * Copyright (C) The Pennsylvania State University 2008 <tpk5010@psu.edu>
 */

/* interface.c: where babies are made. And by babies, I mean our application's
   interface. Interface.c and interface.h define an AppUIData object which reads
   from the GladeXML file to create all the application's widgets. This object
   is what's thrown around in callback functions.
*/

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif
#include <glade/glade.h>
#include "interface.h"

AppUIData *interface_main_view_new( AppData *data ) {

    /* Zero memory with g_new0 */
    AppUIData* result = g_new0( AppUIData, 1 );

    /* Initialize interface data */
    /* Store handle to app's data to view's data */
    result->data = data;

    /* Now for the incredibly tedious part of assigning widgets to GladeXML items */
    result->window = glade_xml_get_widget(result->data->gxml, "window");
	result->logview = GTK_TEXT_VIEW(glade_xml_get_widget(result->data->gxml, "logview"));
	result->submitbutton = glade_xml_get_widget(result->data->gxml, "submitbutton");
	result->recordtoggle = glade_xml_get_widget(result->data->gxml, "recordtoggle");
	result->clearbutton = glade_xml_get_widget(result->data->gxml, "clearbutton");
	result->stopbutton = glade_xml_get_widget(result->data->gxml, "stopbutton");
	result->severitycombo = glade_xml_get_widget(result->data->gxml, "severitycombo");
	result->categorycombo = glade_xml_get_widget(result->data->gxml, "categorycombo");
	result->detailsview = glade_xml_get_widget(result->data->gxml, "detailsview");
	result->timeLabel = glade_xml_get_widget(result->data->gxml, "timeLabel");
	result->streamStatusIcon = glade_xml_get_widget(result->data->gxml, "streamStatusIcon");	
	result->gpsStatusLabel = glade_xml_get_widget(result->data->gxml, "gpsStatusLabel");
	result->gpsLatLabel = glade_xml_get_widget(result->data->gxml, "gpsLatLabel");
	result->gpsLongLabel = glade_xml_get_widget(result->data->gxml, "gpsLongLabel");

    return result;
}

void interface_main_view_destroy( AppUIData *main ) {

    g_free( main );
}

